/* 
 * File:   DielectricShader.h
 * Author: brady
 *
 * Created on August 10, 2011, 7:11 PM
 */

#ifndef DIELECTRICSHADER_H
#define	DIELECTRICSHADER_H

#include <shaders/BlinnphongShader.h>


class DielectricShader : public BlinnphongShader {
public:
    DielectricShader();
    DielectricShader(const DielectricShader& orig);
    virtual ~DielectricShader();
    void setTransparency(double t){transparency = t;}
    void setRefractiveIndex(double r){refractiveIndex = r;}
    Vector3D shade(IntersectionResult& result) const ;
protected:
    Vector3D computeRefractions(IntersectionResult& result, const Ray& reflectedRay) const;
    double transparency;
    double refractiveIndex;
private:
    double schlickReflectance(const Ray& ray_i, const Ray& ray_t, const Vector3D& normal) const;
    Ray roulette(const Ray& ray_i, IntersectionResult& result) const;
    Vector3D importance(const Ray& ray_i, const Ray& ray_t, IntersectionResult& result) const;

};

#endif	/* DIELECTRICSHADER_H */

